From 36105221f4d51cc701c93a3ff6c5783fe36320c8 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Mon, 20 Jul 2026 18:16:06 +0000 Subject: [PATCH] Create, document, index, and trigger TLK_BRECORD_NOTES_CODES --- db/schemas/housekeeping/indexes/Makefile | 3 +- .../indexes/create/tlk_brecord_notes_codes.m4 | 26 +++++++ .../indexes/drop/tlk_brecord_notes_codes.m4 | 24 ++++++ db/schemas/housekeeping/tables/Makefile | 3 +- .../tables/create/tlk_brecord_notes_codes.m4 | 36 +++++++++ db/schemas/lib/triggers/Makefile | 3 +- .../create/tlk_brecord_notes_codes.m4 | 49 ++++++++++++ .../triggers/drop/tlk_brecord_notes_codes.m4 | 23 ++++++ doc/src/epilog.inc.m4 | 9 +++ doc/src/housekeeping.m4 | 1 + .../housekeeping/tlk_brecord_notes_codes.m4 | 77 +++++++++++++++++++ 11 files changed, 251 insertions(+), 3 deletions(-) create mode 100644 db/schemas/housekeeping/indexes/create/tlk_brecord_notes_codes.m4 create mode 100644 db/schemas/housekeeping/indexes/drop/tlk_brecord_notes_codes.m4 create mode 100644 db/schemas/housekeeping/tables/create/tlk_brecord_notes_codes.m4 create mode 100644 db/schemas/lib/triggers/create/tlk_brecord_notes_codes.m4 create mode 100644 db/schemas/lib/triggers/drop/tlk_brecord_notes_codes.m4 create mode 100644 doc/src/housekeeping/tlk_brecord_notes_codes.m4 diff --git a/db/schemas/housekeeping/indexes/Makefile b/db/schemas/housekeeping/indexes/Makefile index c865154..39ee291 100644 --- a/db/schemas/housekeeping/indexes/Makefile +++ b/db/schemas/housekeeping/indexes/Makefile @@ -21,7 +21,8 @@ # This is not really important but is needed for other types of db objects. ORDER := aggression_event_log \ biography_log \ - chimps_on_tikis + chimps_on_tikis \ + tlk_brecord_notes_codes ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/housekeeping/indexes/create/tlk_brecord_notes_codes.m4 b/db/schemas/housekeeping/indexes/create/tlk_brecord_notes_codes.m4 new file mode 100644 index 0000000..73c0ed9 --- /dev/null +++ b/db/schemas/housekeeping/indexes/create/tlk_brecord_notes_codes.m4 @@ -0,0 +1,26 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +CREATE UNIQUE INDEX IF NOT EXISTS tlk_brecord_notes_codes_abbreviation + ON tlk_brecord_notes_codes + (sdb_case_equivalence(`abbreviation')); diff --git a/db/schemas/housekeeping/indexes/drop/tlk_brecord_notes_codes.m4 b/db/schemas/housekeeping/indexes/drop/tlk_brecord_notes_codes.m4 new file mode 100644 index 0000000..8b5dd69 --- /dev/null +++ b/db/schemas/housekeeping/indexes/drop/tlk_brecord_notes_codes.m4 @@ -0,0 +1,24 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +DROP INDEX IF EXISTS tlk_brecord_notes_codes_abbreviation; diff --git a/db/schemas/housekeeping/tables/Makefile b/db/schemas/housekeeping/tables/Makefile index 6a7702d..43e1b43 100644 --- a/db/schemas/housekeeping/tables/Makefile +++ b/db/schemas/housekeeping/tables/Makefile @@ -22,7 +22,8 @@ # into the database after the tables they reference. ORDER := aggression_event_log \ biography_log \ - chimps_on_tikis + chimps_on_tikis \ + tlk_brecord_notes_codes ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/housekeeping/tables/create/tlk_brecord_notes_codes.m4 b/db/schemas/housekeeping/tables/create/tlk_brecord_notes_codes.m4 new file mode 100644 index 0000000..b857723 --- /dev/null +++ b/db/schemas/housekeeping/tables/create/tlk_brecord_notes_codes.m4 @@ -0,0 +1,36 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`tablemacros.m4')dnl +include(`grants.m4')dnl +dnl + +CREATE TABLE tlk_brecord_notes_codes ( + key_column(`TLK_BRECORD_NOTES_CODES', `ID', INTEGER) + ,abbreviation TEXT NOT NULL + emptytext_check(`Abbreviation') + trimmedofspaces_check(`Abbreviation') + ,meaning TEXT NOT NULL + emptytext_check(`Meaning') + trimmedofspaces_check(`Meaning') +); + +grant_priv(`TLK_BRECORD_NOTES_CODES') diff --git a/db/schemas/lib/triggers/Makefile b/db/schemas/lib/triggers/Makefile index 660c3c7..330b382 100644 --- a/db/schemas/lib/triggers/Makefile +++ b/db/schemas/lib/triggers/Makefile @@ -57,7 +57,8 @@ ORDER := comm_ids \ elo_ranks_daily_mt_f \ elo_ranks_daily_mt_m \ aggression_event_log \ - chimps_on_tikis + chimps_on_tikis \ + tlk_brecord_notes_codes DROP_EXISTING := true diff --git a/db/schemas/lib/triggers/create/tlk_brecord_notes_codes.m4 b/db/schemas/lib/triggers/create/tlk_brecord_notes_codes.m4 new file mode 100644 index 0000000..66c22d9 --- /dev/null +++ b/db/schemas/lib/triggers/create/tlk_brecord_notes_codes.m4 @@ -0,0 +1,49 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify it +dnl under the terms of the GNU Affero General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Triggers for the tlk_brecord_notes_codes table +dnl +dnl Karl O. Pinc + +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`macros.m4')dnl + + +RAISE INFO 'tlk_brecord_notes_codes_update_func'; +CREATE OR REPLACE FUNCTION tlk_brecord_notes_codes_update_func () + RETURNS trigger + LANGUAGE plpgsql + sdb_function_set_search_path + AS $$ + BEGIN + -- Function for tlk_brecord_notes_codes update trigger + -- + -- AGPL_notice(` --', `2026', + `The Meme Factory, Inc., www.karlpinc.com') + + cannot_change(`TLK_BRECORD_NOTES_CODES', `ID') + + RETURN NULL; + END; +$$; + + +RAISE INFO 'tlk_brecord_notes_codes_update_trigger'; +CREATE TRIGGER tlk_brecord_notes_codes_update_trigger + AFTER INSERT OR UPDATE + ON tlk_brecord_notes_codes FOR EACH ROW + EXECUTE PROCEDURE tlk_brecord_notes_codes_update_func(); diff --git a/db/schemas/lib/triggers/drop/tlk_brecord_notes_codes.m4 b/db/schemas/lib/triggers/drop/tlk_brecord_notes_codes.m4 new file mode 100644 index 0000000..a457bbf --- /dev/null +++ b/db/schemas/lib/triggers/drop/tlk_brecord_notes_codes.m4 @@ -0,0 +1,23 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Drop triggers for tlk_brecord_notes_codes table +dnl +dnl Karl O. Pinc + +dnl m4 includes +include(`copyright.m4')dnl + +DROP FUNCTION IF EXISTS tlk_brecord_notes_codes_update_func() CASCADE; diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 927942f..99f24fb 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -780,6 +780,15 @@ elo_ranks_daily_rst(sdb_male, MT)dnl .. |SWELLING_STATES.SwellingMaxSource| replace:: :ref:`SwellingMaxSource ` +.. |TLK_BRECORD_NOTES_CODES| replace:: + :ref:`TLK_BRECORD_NOTES_CODES ` +.. |TLK_BRECORD_NOTES_CODES.ID| replace:: + :ref:`ID ` +.. |TLK_BRECORD_NOTES_CODES.Abbreviation| replace:: + :ref:`Abbreviation ` +.. |TLK_BRECORD_NOTES_CODES.Meaning| replace:: + :ref:`Meaning ` + .. |WATCHES| replace:: :ref:`WATCHES ` .. |WATCHES.WID| replace:: :ref:`WID ` diff --git a/doc/src/housekeeping.m4 b/doc/src/housekeeping.m4 index a6e3443..bdbbde8 100644 --- a/doc/src/housekeeping.m4 +++ b/doc/src/housekeeping.m4 @@ -36,3 +36,4 @@ The tables in this section are all in the ``housekeeping`` schema. housekeeping/aggression_event_log.rst housekeeping/biography_log.rst housekeeping/chimps_on_tikis.rst + housekeeping/tlk_brecord_notes_codes.rst diff --git a/doc/src/housekeeping/tlk_brecord_notes_codes.m4 b/doc/src/housekeeping/tlk_brecord_notes_codes.m4 new file mode 100644 index 0000000..879ba3f --- /dev/null +++ b/doc/src/housekeeping/tlk_brecord_notes_codes.m4 @@ -0,0 +1,77 @@ +.. Copyright (C) 2026 The Meme Factory, Inc. www.karlpinc.com + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +.. M4 setup +include(constants.m4)dnl +include(macros.m4)dnl +sdb_rst_quotes(`on')dnl +sdb_generated_rst()dnl + +.. _TLK_BRECORD_NOTES_CODES: + +TLK_BRECORD_NOTES_CODES +------------------------ + +.. |TLK_BRECORD_NOTES_CODES_summary| replace:: + + Each row records an abbreviation used in B-Record note taking. + +|TLK_BRECORD_NOTES_CODES_summary| + + +.. contents:: + :depth: 2 + + +.. _TLK_BRECORD_NOTES_CODES.ID: + +ID (IDentifier) +``````````````` + +.. |TLK_BRECORD_NOTES_CODES.ID_summary| replace:: |idcol| + +|TLK_BRECORD_NOTES_CODES.ID_summary| |notnull| + + +.. _TLK_BRECORD_NOTES_CODES.Abbreviation: + +Abbreviation +```````````` + +.. |TLK_BRECORD_NOTES_CODES.Abbreviation_summary| replace:: + An abbrevation used in B-Record note taking. + +|TLK_BRECORD_NOTES_CODES.Abbreviation_summary| + +|uniquenocase| + +|emptytext| +|trimmedofspaces| +|notnull| + + +.. _TLK_BRECORD_NOTES_CODES.Meaning: + +Meaning +``````` + +.. |TLK_BRECORD_NOTES_CODES.Meaning_summary| replace:: + A description of the abbrevation. + +|TLK_BRECORD_NOTES_CODES.Meaning_summary| + +|emptytext| +|trimmedofspaces| +|notnull| -- 2.34.1